import axios from 'axios'
export default {
  namespaced: true,
  state() {
    return {
      film: []
    }
  },
  actions: {
    async asyncxios(context) {
      // axios({
      //   method: 'get',
      //   url: 'https://m.maizuo.com/gateway?cityId=310100&pageNum=1&pageSize=3&type=1&k=5253448',
      //   headers: {
      //     'X-Host': 'mall.film-ticket.film.list'
      //   }
      const res = await axios.get(
        'https://m.maizuo.com/gateway?cityId=310100&pageNum=1&pageSize=10&type=1&k=552868',
        {
          headers: {
            'X-Client-Info':
              '{"a":"3000","ch":"1002","v":"5.2.1","e":"16659873613985695290949633","bc":"310100"}',
            'X-Host': 'mall.film-ticket.film.list'
          }
        }
      )
      // }).then((res) => {
      context.commit('aAxios', res.data.data.films)
      console.log('asyncxios------>', res)
      //   // this.urlmsg = res.films
      // })
    }
  },
  mutations: {
    aAxios(state, asyncmsg) {
      state.film = asyncmsg
      console.log('mutations-------->111')
    }
  }
  // actions: {
  //   asyncxios(context) {
  //     context.commit('aAxios', '111')
  //   }
  // }
}
